/**
 * Applikationsutveckling i Java, 5DV135
 * HT12
 * Project
 * 
 * File: ZoneTest.java
 * Description: A JUnitTestCaseClass used to test the class
 * 				Zone
 * Date: 18 december 2012
 * 
 * cs-user: dv11mgr
 * @author Maria Gramner
 */

package nullInvader.Test;
import java.util.List;
import nullInvader.Engine.Field;
import nullInvader.Engine.Road;
import nullInvader.Engine.Rock;
import nullInvader.Engine.Unit;
import nullInvader.Engine.Zone;
import junit.framework.TestCase;


public class ZoneTest extends TestCase {
	Field road; 
	Zone zone;


	/**
	 * setUp method that creates the necessary objects
	 * for testing correctly
	 */
	public void setUp(){
		road = new Road(true);
		zone = new Zone(road);
	}


	/**
	 * Test for the constructor
	 */
	public void testConstruction(){
		Zone zone1 = new Zone(road);
		/*Checks that a zone was made*/
		assertNotNull(zone1);
	}


	/**
	 * Test to check that the method getBrick() works correctly
	 */
	public void testGetBrick(){
		Field brick = zone.getBrick();
		/*The brick should be road*/
		assertEquals(road, brick);
	}


	/**
	 * Checks if the method setBrick() works correctly
	 */
	public void testSetBrick(){
		Field rock = new Rock(false);
		zone.setBrick(rock);
		/*The brick should now be rock*/
		assertEquals(rock, zone.getBrick());
	}


	/**
	 * Test to check the method getUnitList()
	 */
	public void testGetUnitList(){
		List<Unit> list = zone.getUnitList();
		/*Checks that a list was returned*/
		assertNotNull(list);
	}


	/**
	 * tearDown method
	 */
	public void tearDown(){
		road = null;
		zone = null;
	}
}
